CDTOOL-1328 list version refactor#1774
Merged
anthony-gomez-fastly merged 6 commits intomainfrom May 8, 2026
Merged
Conversation
a740a16 to
429df46
Compare
…e specific service version filter API calls Co-Authored-By: Richard Carillo <77027245+rcaril@users.noreply.github.com>
429df46 to
0c76483
Compare
Member
Author
|
most of the changes are updating the tests to use the right mock |
rcaril
approved these changes
May 7, 2026
Member
rcaril
left a comment
There was a problem hiding this comment.
Minor points - but the PR is good to go as is if you would like to defer these. Thanks for all of your hard work on this @anthony-gomez-fastly !
kpfleming
approved these changes
May 7, 2026
Member
kpfleming
left a comment
There was a problem hiding this comment.
Yes, I agree this looks great. I thought we had already added --version=staged but I guess we never did!
Member
Author
|
@kpfleming added staging! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change summary
Performance Optimization - Skip ListVersions API call for numeric versions
Changes to pkg/argparser/flags.go:
- Added early return when user provides numeric version (e.g., --version 1)
- Returns &fastly.Version{Number: n} directly without calling ListVersions API
- Saves 1 API call per command when numeric version is used
- Non-numeric versions (e.g., "latest", "active") still call API as before
- Added stateUnknown check: v.Active == nil && v.Locked == nil
- Updated autoclone condition to include stateUnknown case
- Effect: When --autoclone is provided with numeric version, always clones (defensive behavior) since state is unknown
- Maintains safety while benefiting from optimization
Changes to pkg/argparser/flags_test.go:
All Submissions:
New Feature Submissions:
Changes to Core Features: